babl_db_find (BablDb *db,
const char *name)
{
- return babl_hash_table_find (db->name_hash, babl_hash_by_str (db->name_hash, name), (void *) name);
+ Babl *ret;
+ ret = babl_hash_table_find (db->name_hash, babl_hash_by_str (db->name_hash, name),
+ NULL, (void *) name);
+ return ret;
}
int
babl_db_count (BablDb *db)
{
- return db->babl_list->count;
+ int ret;
+ ret = db->babl_list->count;
+ return ret;
}
Babl *
* place to brand them with where the item came from. */
item->instance.creator = babl_extender ();
return item;
-
}
void
int id,
const char *name)
{
+ Babl *ret;
if (id)
- return babl_hash_table_find (db->id_hash, babl_hash_by_int (db->id_hash, id), &id);
- return babl_hash_table_find (db->name_hash, babl_hash_by_str (db->name_hash, name), (void *) name);
+ ret = babl_hash_table_find (db->id_hash, babl_hash_by_int (db->id_hash, id), NULL, &id);
+ else
+ ret = babl_hash_table_find (db->name_hash, babl_hash_by_str (db->name_hash, name), NULL, (void *) name);
+ return ret;
}
Babl *
babl_db_exist_by_id (BablDb *db,
int id)
{
- return babl_hash_table_find (db->id_hash, babl_hash_by_int (db->id_hash, id), &id);
+ Babl *ret;
+ ret = babl_hash_table_find (db->id_hash, babl_hash_by_int (db->id_hash, id), NULL, &id);
+ return ret;
}
Babl *
babl_db_exist_by_name (BablDb *db,
const char *name)
{
- return babl_hash_table_find (db->name_hash, babl_hash_by_str (db->name_hash, name), (void *) name);
+ Babl *ret;
+ ret = babl_hash_table_find (db->name_hash, babl_hash_by_str (db->name_hash, name),
+ NULL, (void *) name);
+ return ret;
}
-
/* In the case of equal source and destination formats
* we will search through the fish database for reference fish
* to handle the memcpy */
- id_htable->find_func = find_memcpy_fish;
- babl_hash_table_find (id_htable, hashval, (void *) &ffish);
+ babl_hash_table_find (id_htable, hashval, find_memcpy_fish, (void *) &ffish);
}
else
{
* insert it into the fish database to indicate non-existent fish
* path.
*/
- id_htable->find_func = find_fish_path;
- babl_hash_table_find (id_htable, hashval, (void *) &ffish);
+ babl_hash_table_find (id_htable, hashval, find_fish_path, (void *) &ffish);
if (ffish.fish_path)
{
}
Babl *
-babl_hash_table_find (BablHashTable *htab,
- int hash,
- void *data)
+babl_hash_table_find (BablHashTable *htab,
+ int hash,
+ BablHashFindFunction find_func,
+ void *data)
{
int it;
Babl *item;
for (;;)
{
- if (htab->find_func (item, data))
+ if (find_func)
+ {
+ if (find_func (item, data))
+ return item;
+ }
+ else if (htab->find_func (item, data))
return item;
it = htab->chain_table[it];
if (it == -1)